package com.lianzhihui.romeex.adapter;

import android.content.Context;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lianzhihui.romeex.R;
import com.lianzhihui.romeex.bean.user.WalletInfo;
import com.lianzhihui.romeex.utils.LogUtil;
import com.lianzhihui.romeex.utils.UserUtils;

import java.util.List;


/**
 * 项目：ocToken
 * 文件描述：管理钱包界面列表  adapter
 * 作者：ljj
 * 创建时间：2020/2/4
 */
public class WalletManagerAdapter extends BaseQuickAdapter<WalletInfo, BaseViewHolder> {

    private Context context;
    private List<WalletInfo> addrList;

    public WalletManagerAdapter(Context context, @Nullable List<WalletInfo> addrList) {
        super(R.layout.item_wallet_manager, addrList);
        this.context = context;
        this.addrList = addrList;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder holder, WalletInfo item) {
        LogUtil.error("ramon", item.toString());
        holder.setIsRecyclable(false);
        holder.setText(R.id.item_tv_wallet_name, item.getUserName());
        holder.setText(R.id.item_tv_wallet_addr, item.getAddress());

        holder.addOnClickListener(R.id.item_tv_wallet_addr);
        holder.addOnClickListener(R.id.item_iv_setting);
        if (item.getAddress().equals(UserUtils.getCurrentUserAddress())) {
            holder.setBackgroundRes(R.id.item_wallet, R.drawable.group_white_bord_1dp_8dp);
        } else {
            holder.setBackgroundRes(R.id.item_wallet, R.drawable.group_white_8dp);
        }

    }

}
